<!DOCTYPE html>
<html lang="zh-CN">
<head>
 
<#include "bases/global_style.ftl">
<#include "bases/global_js.ftl">
<#include "bases/combo.ftl">
 
	    
    <script>
        var curent_page=${currentpage};
 
        var dataform;
        jQuery(document).ready(function()
        {
            var optInit = getOptionsFromForm();
            $("#Pagination").pagination(${totalRecord}, optInit);
            App.init();
            dataform=$("#dataform").validate();
        });
 
        function doTableSort(ID){
        	
            $("#postsortfield").val(ID);
            $("#currentpage").val(0);
            $("#searchform").submit();
        }
        
 
 
 
        function hidePopup() 
        {//关闭层
 
            var backDiv = document.getElementById("backDiv");
            backDiv.style.visibility = "hidden";
            var realDiv = document.getElementById("realDiv");
            realDiv.style.visibility = "hidden";
        }
        
        function showPopup(div) 
        {//弹出层
            var backDiv = document.getElementById("backDiv");
            backDiv.style.top = "0%";//设置弹出层距离上边界的距离
            backDiv.style.left = "0%";//设置弹出层距离左边界的距离
            backDiv.style.width = "100%";//设置弹出层的宽度
            backDiv.style.height = "100%";//设置弹出层的高度
            backDiv.style.visibility = "visible";

            var realDiv = document.getElementById(div);
            realDiv.style.top = "10%";//设置弹出层距离上边界的距离
            realDiv.style.left = "30%";//设置弹出层距离左边界的距离
            realDiv.style.width = "40%";//设置弹出层的宽度
            realDiv.style.height = "auto";//设置弹出层的高度
            realDiv.style.visibility = "visible";
        }
        
        function showIntegralRule(){
        	
        	getIntegralRule();
        	showPopup('realDiv');
        
        }
        
        function getIntegralRule(){
        	
    		$.ajax({
    			type : "POST",
        		url : CONTEXT+'/get_integral_rule',
        		dataType : "json",  
      	      	success : function(data) {
      	      		
      	      		if(data.score!=null){
      	      		   $("#dataform #score").attr("readonly",true);
      	      		   $("#dataform #amount_deci").attr("readonly",true);
          	           $("#dataform #amount").attr("readonly",true);
          	           $("#dataform #submit_btn").css("display","none");
      	      		}
      	            $("#dataform #score").val(data.score);
      	            $("#dataform #amount_deci").val(data.amount/100);
      	            $("#dataform #amount").val(data.amount);
      	      	}
    		});
        }
    </script>
  
</head>

<body>
 

<div id="backDiv" onclick="hidePopup()" style="position: absolute;visibility: hidden;position:fixed;overflow: hidden;solid: #000000;background-color: #000000;padding: 1px;z-index: 99;filter:alpha(opacity=50);opacity: 0.5;"></div>

<div id="realDiv" class="row-fluid" style="position: absolute;visibility: hidden;overflow: hidden;padding: 1px;z-index: 100;background-color: #FFFFFF;">
    <div class="span12">
        <div class="portlet box green" style="padding: 0px;margin:0px;">
            <div class="portlet-title">
                <div class="caption"><i class="fa fa-plus"></i>积分规则</div>
                <a href="javascript:allDivHide();" class="remove"></a>
            </div>

            <div class="portlet-body flip-scroll">
                <form id="dataform"   method="POST" action="${base}/save_integral_rule">
                    <table class="table-bordered table-striped table-condensed flip-content">
                      <tbody role="alert" aria-live="polite" aria-relevant="all">
                      <tr class="odd">
                            <td style="text-align: right;">每消费<span class="fill-must">*</span></td>
                            <td class="even">
								    <input type="number"  name="score"  id="score" class="form-control sheet-jfInput" placeholder="" required>
								    <span class="sheet-jf">元 </span>
                            </td>
                        </tr>
                        <tr class="even">
                            <td style="text-align: right;">积<span class="fill-must">*</span></td>
                            <td class="even">
								    <input type="number"  id="amount_deci" onchange="$(this).next().val($(this).val()*100)"  class="form-control sheet-jfInput" placeholder="" required>
								    <input type="hidden"  id="amount"  name="amount"> 
								    <span class="sheet-jf">分</span>
                            </td>
                        </tr>
                     </tbody>
                    </table>
                    </br>
                    <div class="controls controls-row" style="text-align: right;">
                        <input type="submit"  id="submit_btn"  value="提交" class="btn green"/>
                        <input type="button" value="取消" class="btn green" onclick="hidePopup()" />
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
 
 
<div class="page-container row-fluid">

<#include "bases/sidebar.ftl">
<#include "bases/navhead.ftl">

    <div class="page-content secMenu-content" id="loading">
     
        <div class="container-fluid">
 
            <div class="row-fluid">
                <div class="span12">
                    <div class="portlet box green">
                        <div class="portlet-title">
                            <div class="caption"><i class="fa fa-cogs"></i>积分奖励列表</div>
                            <div class="tools">
                                <a href="javascript:window.location.reload()" class="reload"></a>
                            </div>
                        </div>
                        <div class="portlet-body flip-scroll">
                            <form id="searchform" action="${base}/integral_manage" method="POST">
                               
                                <div class="controls controls-row">
                                    <input  name="tel" type="text" class="form-control sheet-searchInput" id="tel" value="<#if tel??>${tel}</#if>" placeholder="手机号"/>
                                   
                                    <input  name="account" type="text" class="form-control sheet-searchInput" id="account" value="<#if account??>${account}</#if>" placeholder="账号"/>
                                   
                                    <button type="submit" class="btn blue">搜索 </button>
                                
                                    <input  type="hidden" id="currentpage" name="page" value="0" />
                                    <input  type="hidden" id="postsortfield" name="sortfield" value="<#if sortfield??>${sortfield}</#if>" />
                             
                                </div>
                                <div class="controls controls-row" style="margin-top: 20px">
                                    <button type="button" class="btn green" onclick="showIntegralRule()"><i class="fa fa-edit"></i>查看积分规则</button>
 
                                </div>
                                <table  class="table table-bordered table-hover table-striped table-condensed list-table">
                                    <thead class="flip-content">
                                    <tr>
                                          <th style="text-align: center;">编号</th>
                                    	  <th style="text-align: center;">账号</th>
								          <th style="text-align: center;">姓名</th>
								          <th style="text-align: center;">累计消费</th>
								          <th style="text-align: center;">获得积分</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <#list score_rule_receive_list as item>
                                    <tr>
                                        <td style="text-align: center;"><#if item_index??>${item_index+1}</#if></td>
                                        <td style="text-align: center;"><#if item.getAccount()??>${item.getAccount()}</#if></td>
                                        <td style="text-align: center;"><#if item.getAccountName()??>${item.getAccountName()}</#if></td>
                                        <td style="text-align: center;"><#if item.getTotalamount()??>${item.getTotalamount()/100}</#if></td>
                                        <td style="text-align: center;"><#if item.getScore()??>${item.getScore()}</#if></td>
                                    </tr>
                                    </#list>
                                    </tbody>
                                </table>
                                <div class="controls controls-row">
                                    <div id="Pagination" class="pagination"></div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
  </div>
 
</body>
</html>

 
